from typing import Literal, TypedDict


SSID_COOKIE_NAME = "ssid"
SESSION_COOKIE_NAME = "session"
SESSION_EMPTY_TTL = 60 * 10
SESSION_FILLED_TTL = 3600 * 24
JWT_VERSION = 1
JWT_SECRET = "hello_next_hello"
JWT_ENCRPYTION_KEY = "hello_next_hel1234llo_next_hello"



class JWTPayloadUserPart(TypedDict):
    uid: str | int
    perms: str
    role: str


class JWTPayload(JWTPayloadUserPart):
    ssid: str
    jwtVersion: int
    exp: int  # 过期时间（具体时间戳，不是剩多少秒）
    iat: int  # 签发时间（具体时间戳，不是剩多少秒）


class RedisPayload(TypedDict):
    uid: str | int
    status: str
    loginTime: int
    lastActivity: int
    ipAddress: str
    userAgent: str
    loginMethod: str
    role: str
    perms: str
    sessionAesKey: str
    createdAt: int
    sessionType: Literal["normal", "remember"]
